-
Notifications
You must be signed in to change notification settings - Fork 121
[WIP] Add WebView authentication #7924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b70c42c to
d2091c2
Compare
| } | ||
|
|
||
| extension WebKitViewController: WKUIDelegate { | ||
| func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 160 characters or less: currently 187 characters (line_length)
| decisionHandler(.allow) | ||
| } | ||
|
|
||
| func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 160 characters or less: currently 163 characters (line_length)
|
|
||
| NSLayoutConstraint.activate(edgeConstraints) | ||
|
|
||
| // we are pinning the top and bottom of the stack view to the safe area to prevent unintentionally hidden content/overlaps (ie cookie acceptance popup) then center the horizontal constraints vertically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 160 characters or less: currently 209 characters (line_length)
You can test the changes from this Pull Request by:
|
| headers.forEach { (key, value) in | ||
| request.setValue(value, forHTTPHeaderField: key) | ||
| } | ||
| // request.setValue(WPUserAgent.wordPress(), forHTTPHeaderField: "User-Agent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to set up another user agent here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason for that. Nothing changed when I copy-pasted exact user-agent string from WP.
Without explicit setter it will be same as default: WooCommerce/10.8.0.0 CFNetwork/1390 Darwin/22.1.0.
#7911
Description
This PR adds code from WP app to correctly authenticate user in the webview.
We need only atomic and self-hosted sites support, so we don't have to reimplement all the flows.
Video
RPReplay_Final.mp4